import request from './request'

// 获取所有活动分类
export function getAllCategories() {
  return request.get('/categories')
}

// 根据ID获取分类
export function getCategoryById(id) {
  return request.get(`/categories/${id}`)
}

// 创建分类
export function createCategory(data) {
  return request.post('/categories', data)
}

// 更新分类
export function updateCategory(id, data) {
  return request.put(`/categories/${id}`, data)
}

// 删除分类
export function deleteCategory(id) {
  return request.delete(`/categories/${id}`)
}

// 获取分类下的活动数量
export function getCategoryActivityCount(categoryId) {
  return request.get(`/categories/${categoryId}/activity-count`)
}

// 获取热门分类
export function getHotCategories(limit = 6) {
  return request.get('/categories/hot', { limit })
}

// 为了兼容现有代码，添加getCategoryList作为getAllCategories的别名
export const getCategoryList = getAllCategories